package dt.inlee.system.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import dt.inlee.common.pagination.OrderBean;
import dt.inlee.common.pagination.PageBean;
import dt.inlee.common.pagination.SearchBean;
import dt.inlee.system.dao.api.IDxTempDao;
import dt.inlee.system.model.DxTempEntity;


@Service("dxTempService")
public class DxTempService {
	@Resource(name="dxTempDao")
	private IDxTempDao  dxTempDao;
	
 

	/**
	 * Add a data
	 * @param 
	 * @return
	 */
	public String save(DxTempEntity entity) {

		return dxTempDao.save(entity);
	}
	
	/**
	 * Update a data
	 * @param 
	 * @return
	 */
	public void update(DxTempEntity entity) {

		dxTempDao.update(entity);
	}

	/**
	 * Show a data
	 * @param id
	 * @return
	 */
	public DxTempEntity getDxTempById( String id) {		 
		return dxTempDao.get(id);
	}
	
	
	/**
	 * Delete an object by id
	 * @param RecordEntity
	 * @return
	 */
	public void deleteById(String id) {
		dxTempDao.delete(id);
    }
	
	public PageBean GetPage(SearchBean sb, int pageIndex, int pageSize) {

		PageBean pageBean=new PageBean();
		pageBean.setPageIndex(pageIndex);
		pageBean.setPageSize(pageSize);
		
		if(sb==null){
			sb=new SearchBean();
		}
		
		OrderBean orderBean=new OrderBean("id",false);
		sb.addOrder(orderBean);
		
		pageBean.setParams(sb);
		this.dxTempDao.searchByPagination(pageBean);
//		total[0]=pageBean.getTotalData();
		return pageBean;
	}
	
	public PageBean getList(SearchBean sb,int rows,int page)
	{
		return this.GetPage(sb,page,rows);
	}

	public List<DxTempEntity> getList()
	{
		SearchBean sb=new SearchBean();
		return this.dxTempDao.find(sb);
	}

	public List<DxTempEntity> getList(SearchBean sb)
	{
		return this.dxTempDao.find(sb);
	}

}
